package org.easiermock;

import org.aopalliance.intercept.MethodInvocation;
import org.junit.Assert;
import org.junit.Test;

public class DefaultMockContextTest {
	
	@Test
	public void testAddMethodListener() {
		DefaultMockContext defaultMockContext = new DefaultMockContext();
		
		MethodListener[] methodListeners = defaultMockContext.getMethodListeners();
		Assert.assertEquals(0, methodListeners.length);
		
		MethodListener methodListener = new MethodListener() {
			public void beforeInvocation(MethodInvocation invocation) {
				// No implementation needed
			}
		};
		defaultMockContext.addMethodListener(methodListener);
		
		methodListeners = defaultMockContext.getMethodListeners();
		Assert.assertEquals(1, methodListeners.length);
		Assert.assertSame(methodListeners[0], methodListener);
	}
	
}
